<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>使用bootstrap绘制form表单</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="${pageContext.servletContext.contextPath}/static/css/zmjorder.css">
<link
	href="${pageContext.servletContext.contextPath}/static/plugins/bootstrap-3.3.7-dist/css/bootstrap.min.css"
	rel="stylesheet">
<link
	href="${pageContext.servletContext.contextPath}/static/plugins/bootstrap-3.3.7-dist/css/bootstrap-theme.min.css"
	rel="stylesheet">
<!-- bootstrap-datepicker-1.9.0-dist -->
<link
	href="${pageContext.servletContext.contextPath}/static/plugins/bootstrap-datepicker-1.9.0-dist/css/bootstrap-datepicker.min.css"
	rel="stylesheet">

<!-- Bootstrap core JavaScript-->
<!-- Placed at the end of the document so the pages load faster -->
<!--import jquery before bootstrap javascript-->
<script
	src="${pageContext.servletContext.contextPath}/static/plugins/jquery-1.12.4/jquery-1.12.4.min.js"></script>
<script
	src="${pageContext.servletContext.contextPath}/static/plugins/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<!-- bootstrap-datepicker-1.9.0-dist -->
<script
	src="${pageContext.servletContext.contextPath}/static/plugins/bootstrap-datepicker-1.9.0-dist/js/bootstrap-datepicker.min.js"></script>

<script
	src="${pageContext.servletContext.contextPath}/static/plugins/bootstrap-datepicker-1.9.0-dist/locales/bootstrap-datepicker.zh-CN.min.js"></script>
<!-- My97DatePicker -->
<script
	src="${pageContext.servletContext.contextPath}/static/plugins/My97DatePicker/WdatePicker.js"></script>
 <!--省市联动插件-->
    <script src="${pageContext.servletContext.contextPath}/static/plugins/jQueryDistpicker20190604/src/distpicker.data.js"></script>
    <script src="${pageContext.servletContext.contextPath}/static/plugins/jQueryDistpicker20190604/src/distpicker.js"></script>
    <script src="${pageContext.servletContext.contextPath}/static/plugins/jQueryDistpicker20190604/js/main.js"></script>
    
    
   

   

<script type="text/javascript">
	// 给日期输入框添加事件处理
	$(function() {
	// dom ready 直接执行的代码块
		
		
		// 执行ajax查询操作
		doAjaxQuery();
	});
	
	// ajax进行查询，填充表单标签值
	
	function doAjaxQuery(){
		// 使用ajax进行查询
		$.ajax({
				// 请求类型
			   type: "POST",
				// 请求的url，和form的action属性值一样
			   url: "${pageContext.servletContext.contextPath}/orderPreModifyControl",
				// 发送的表单数据，按照如下格式提供即可："name=John&location=Boston"
			   data:  "a_id="+$("#a_id").val(),// 序列化表单参数，获取一个序列化的字符串，用于ajax请求，必须在form中才可以使用
			   // response响应的数据类型，默认是文本类型，可以指定为 xml、html、json等类型
			   dataType:"json",
			   // 回调函数
			   success: function(data){			     
			     // 进行dom操作，局部修改浏览器的显示数据，进行局部刷新数据
			     console.info(data);
				 if(data != null){
					 // 使用dom操作进行表单数据填充
					 // data是一个实体类的json对象
					 $("#shr").val(data.a_name);
					 $("#sjhm").val(data.a_phone);
					 
					 $('#target').distpicker('destroy');//销毁实例
					
					 
					 $('#target').distpicker({//动态赋值
							province: data.a_province,
							city: data.a_city,
							district: data.a_district
						});
					
					 $("#xxdz").val(data.a_daddress);
					 
					 
					
					
					 //$("#txtUserName").val(data.user_Name);
					 //$("#txtUserPsw,#txtUserPsw2").val(data.user_Psw);
					 //$("#txtCreateDate").val(data.user_Createtime);
					 //$("#txtUserName").val(data.user_Name);					 
				 }
			   }

			});
	}
	
	
	
	
</script>

<style>
#maindiv {
	width: 80%;
	padding-top: 10px;
}
</style>
</head>
<body>
	<div id="maindiv">
		<form class="form-horizontal" method="post" action="${pageContext.servletContext.contextPath}/AddressSavingControl">
			<!-- 添加隐藏表单域是为了修改使用；将当前修改的记录的主键一并通过form表单传到服务器 -->
			<input type="hidden" name="a_id"
				value="${modifyAddressBean.a_id }">
			<input type="hidden" name="user_id"
				value="${modifyAddressBean.user_id }">
				
			<div class="box-ct-Address">
        		<div class="box-header">
           		 <span class="box-title">收货地址</span>
       		 </div>
        	<div class="box-content">
            
                    <span class="required1">*</span><span class="p-shr">收货人</span>
                    <input type="text" id="shr" class="Address-property-value" name="a_name">
                </div>
              
                <div class="Address-property">
                    <span class="required">*</span><span >手机号码</span>
                    <input type="text" id="sjhm" class="Address-property-value" name="a_phone">
                </div>
               <div class="Address-property-2">
                   <div class="address-l">
                       <span class="required">*</span><span >收货地址</span>
                       <div data-toggle="distpicker" id="target">
                           <select  name="a_province" id="province"></select>
                           <select  name="a_city" id="city"></select>
                           <select  name="a_district" id="district"></select>
                       </div>
                   </div>
                   <div class="address-r">
                       <div class="address-l">
                           <span class="required">*</span><span  >详细地址</span>
                           <input type="text" class="address-r-xxdz" id="xxdz" name="a_daddress">
                       </div>
                   </div>
               </div>
               <div class="form-group">
				<div class="col-sm-offset-2 col-sm-2">
					<input type="submit" class="btn btn-default" value="修改"></input>
				</div>
				<div class="col-sm-offset-4 col-sm-2">
					<button type="reset" class="btn btn-default" >重置</button>
				</div>
			</div>
            
        </div>
   
			
		</form>	
		
	</div>
	
	
	
	
	
	
	
	
	
</body>
</html>